package com.ruoyi.smartcity.anfang.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.smartcity.anfang.service.IAnfangJiankongService;
import com.ruoyi.smartcity.anfang.service.IAnfangJingbaoService;
import com.ruoyi.smartcity.traffic.vo.EchartsOptionVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author harry
 * @公众号 Harry技术
 */
@RestController
@RequestMapping("/smartcity/anfang/index")
public class AnfangIndexController {
    @Resource
    private IAnfangJiankongService anfangJiankongService;
    @Resource
    private IAnfangJingbaoService anfangJingbaoService;

    // 设备类型统计 饼图
    @GetMapping("/deviceType")
    public AjaxResult deviceType() {
        List<Map<String, Object>>   list = anfangJiankongService.deviceType();
        return AjaxResult.success(list);
    }

    // 设备状态统计 柱状图
    @GetMapping("/deviceStatus")
    public AjaxResult deviceStatus() {
        EchartsOptionVO list = anfangJiankongService.deviceStatus();
        return AjaxResult.success(list);
    }

    // 警报日志统计 条形图
    @GetMapping("/jingbaoLog")
    public AjaxResult jingbaoLog() {
        EchartsOptionVO list = anfangJingbaoService.jingbaoLog();
        return AjaxResult.success(list);
    }
}
